package cn.modfun.web.core.model;

import cn.modfun.web.core.annotation.Model;

@SuppressWarnings({ "rawtypes", "serial" })
public class BaseModel<M extends BaseModel> extends com.jfinal.plugin.activerecord.Model<M> {
	
	@SuppressWarnings("unchecked")
	public static String getTableName(Class clazz){
		cn.modfun.web.core.annotation.Model model = (Model) clazz.getAnnotation(cn.modfun.web.core.annotation.Model.class);
		if(model!=null){
			return model.table();
		}else return null;
	}
	
	public String getTableName(){
		return getTableName(this.getClass());
	}
}
